package com.springsource.a06AwareAndInitializingBean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MyBean implements BeanNameAware, ApplicationContextAware, InitializingBean {

    @Override
    public void setBeanName(String name) {
        log.warn("BeanNameAware接口的setBeanName方法执行了，beanName: {}", name);
    }

    @Override
    public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) {
        log.warn("ApplicationContextAware接口的setApplicationContext方法执行了，applicationContext: {}", applicationContext);
    }

    @Override
    public void afterPropertiesSet() {
        log.warn("InitializingBean接口的afterPropertiesSet方法执行了");
    }
}
